<?php

/**
 * 
 * @author szm
 */
class Expansion_model  extends CI_Model{
    public function __construct(){
        parent::__construct();
        $this->load->database();
    }
    public function getExpansions($lessonIds){
        if(empty($lessonIds)){
            return false;
        }
        if(!is_array($lessonIds)){
            $lessonIds=array($lessonIds);
        }
        $lessonIds=implode(",",$lessonIds);
        $sql="select * from expansion_sentences as es
			left join sample_sentences  as ss
        	on es.sample_sentence_id  = ss.sample_sentence_id 
			where ss.lesson_id in ($lessonIds)";
	     try{
            $dbSource=$this->db->query($sql);
            $resultArr=$dbSource->result_array();
            return $resultArr;
	     }catch(Exception $e){
            return $sql;
         }
    }
    public function listAllExpansions(){

    }
    
    public function getExpansion(){

    }
    
    public function saveExpansion(){


    }
    
    public function removeExpansion(){

    }

}

